Example Program
Gotohs Algorithm
Gotoh alignment code example
This code example illustrates a graph-based Gotoh alignment
1#include <seqan/graph_align.h>
2#include <iostream>
3
4using namespace seqan;
5
6int main() {
7    typedef String<char> TString;
8    typedef StringSet<TString, Dependent<> > TStringSet;
9    typedef Graph<Alignment<TStringSet, void> > TGraph;
Alignments are carried out on a StringSet that holds the sequences
10    TStringSet str;
11    TString str0("TarfieldandGarfieldarestupid.");appendValue(str, str0);
12    TString str1("Garfield");appendValue(str, str1);
Configuration of alignment algorithm: Scoring (Match = 2, Mismatch = -1, Gap-extension = -1, Gap-opening = -4)
13    Score<int> score_type = Score<int>(2,-1,-1,-4);
Out-parameter: An alignment graph
14    TGraph g(str);
Global alignment with Gotoh
15    int score = globalAlignment(g, score_type, Gotoh());
Console output
16    std::cout << "Scoring schema: Match=2, Mismatch=-1, Gap-extension=-1, Gap-opening=-4" << std::endl;
17    std::cout << g << std::endl;
18    std::cout << "Score: " << score << std::endl;
The initialization of the matrix and the traceback start can also be controlled. Configuration: AlignConfig<TTop, TLeft, TRight, TBottom>. If TTop, TLeft, TRight, or TBottom is true the corresponding row / column is initialized with 0's or searched for the maximum, respectively.
19    AlignConfig<true,false,false,true> ac;
Global alignment with Gotoh and special initialization
20    int score2 = globalAlignment(g, score_type, ac, Gotoh() );
Console output
21    std::cout << g << std::endl;
22    std::cout << "Score with ends free-space alignment: " << score2 << std::endl;
23    return 0;
24}
SeqAn - Sequence Analysis Library - www.seqan.de